<?php /*a:3:{s:69:"D:\ROOTWWW\myCeshi\tpVue\app\admin\view\system\system_group\index.php";i:1594376172;s:57:"D:\ROOTWWW\myCeshi\tpVue\app\admin\view\public\header.php";i:1599018492;s:57:"D:\ROOTWWW\myCeshi\tpVue\app\admin\view\public\footer.php";i:1594462056;}*/ ?>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>用户管理 - 派后台管理系统</title>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="icon" href="/system/admin/favicon.ico" type="image/ico">
<meta name="keywords" content="H-后台管理系统">
<title>首页 - <?php echo systemConfig("title"); ?></title>
<meta name="description" content="H-后台管理系统">
<meta name="author" content="cfn">
<script src="/system/admin/js/jquery.min.js"></script>
<link href="/system/admin/css/bootstrap.min.css" rel="stylesheet">
<link href="/system/admin/css/materialdesignicons.min.css" rel="stylesheet">
<link href="/system/admin/css/animate.css" rel="stylesheet">
<link href="/system/admin/css/style.min.css" rel="stylesheet">
<link href="/system/admin/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link rel="stylesheet" href="/system/admin/js/jconfirm/jquery-confirm.min.css">
<link rel="stylesheet" href="/system/admin/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
<style>
    .form-inline .form-group label{
        padding: 0 10px;
    }
    .form-inline .form-group{
        margin-bottom: 10px !important;
    }
</style>
</head>
<body>
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header"><h4>组合数据</h4></div>
                <div class="card-body">
                    <div id="toolbar" class="toolbar-btn-action">
                        <button id="btn_add" type="button" class="btn btn-primary m-r-5" onclick="iframe.createIframe('添加数据组','/admin/system.systemGroup/create')">
                            <span class="mdi mdi-plus" aria-hidden="true"></span>新增
                        </button>
                    </div>
                    <table id="tb_departments"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/system/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/system/admin/js/iframe.js"></script>
<script type="text/javascript" src="/system/admin/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<link href="/system/admin/js/x-editable/1.5.1/bootstrap3-editable/css/bootstrap-editable.min.css" rel="stylesheet">
<script type="text/javascript" src="/system/admin/js/x-editable/1.5.1/bootstrap3-editable/js/bootstrap-editable.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-table/extensions/editable/bootstrap-table-editable.min.js"></script>
<script src="/system/admin/js/jconfirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="/system/admin/js/main.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-datetimepicker/moment.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="/system/admin/js/lightyear.js"></script>

<script type="text/javascript">
    Array.prototype.remove = function(val) {
        var index = this.indexOf(val);
        if (index > -1) {
            this.splice(index, 1);
        }
    };

    /**
     * @param fields
     * @returns {{}}
     */
    function toArrayList(fields) {
        var f = {};//声明一个对象
        $.each(fields,function(index,field){
            f[field.name] = field.value;
        });
        return f;
    }
</script>
<script type="text/javascript">
    $('#tb_departments').bootstrapTable({
        classes: 'table table-bordered table-hover table-striped',
        url: '/admin/system.systemGroup/lst',
        method: 'post',
        dataType : 'json',        // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
        uniqueId: 'id',
        idField: 'id',             // 每行的唯一标识字段
        toolbar: '#toolbar',       // 工具按钮容器
        showColumns: true,         // 是否显示所有的列
        showRefresh: true,         // 是否显示刷新按钮
        responseHandler: function (res) {
            return {
                "total": res.count,
                "rows": res.data,
            };
        },
        pagination: true,
        queryParams: function(params) {
            var temp = toArrayList($(".searchForm").serializeArray());
            temp['limit'] = params.limit;
            temp['page'] = (params.offset / params.limit) + 1;
            return temp;
        },
        sidePagination: "server",
        pageNumber: 1,
        pageSize: 20,
        pageList: [20, 50, 100],
        columns: [{
            field: 'id',
            title: 'ID',
            sortable: true,    // 是否排序
            align:"center"
        }, {
            field: 'name',
            title: '数据组名称',
            align:"center"

        }, {
            field: 'info',
            title: '数据组提示',
            align:"center"
        }, {
            field: 'config_name',
            title: '数据组字段',
            align:"center"

        }, {
            field: 'operate',
            title: '操作',
            align:"center",
            formatter: btnGroup,  // 自定义方法
            events: {
                'click .edit-btn': function (event, value, row, index) {
                    iframe.createIframe('编辑数据组','/admin/system.systemGroup/edit?id='+row.id)
                },
                'click .del-btn': function (event, value, row, index) {
                    $.alert({
                        title: '系统提示',
                        content: '删除提醒',
                        buttons: {
                            confirm: {
                                text: '确认',
                                btnClass: 'btn-primary',
                                action: function(){
                                    $.post(url="/admin/system.systemGroup/del",data={"id":row.id},function (res) {
                                        if (res.status == 200) {parent.lightyear.notify('删除成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');$("#tb_departments").bootstrapTable('refresh');}
                                        else parent.lightyear.notify('删除失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
                                    });
                                }
                            },
                            cancel: {
                                text: '取消'
                            }
                        }
                    });
                },
                'click .detail-btn': function (event, value, row, index) {
                    iframe.createIframe('编辑数据组','/admin/system.systemGroupData/index?gid='+row.id)
                },
            }
        }],

        onEditableSave: function (field, row, oldValue, $el) {
            $.ajax({
                type: "get",
                url: "/admin/admin.admin/lst",
                data: row,
                dataType: 'jsonp',
                success: function (data, status) {
                    if (data.code == '200') {
                        // 这里的状态显示有自定义样式区分，做单行的更新
                        $('.example-table').bootstrapTable('updateRow', {index: row.id, row: row});
                    } else {
                        alert(data.msg);
                    }
                },
                error: function () {
                    alert('修改失败，请稍后再试');
                }
            });
        },

        onLoadSuccess: function(data){
            $("[data-toggle='tooltip']").tooltip();
        }
    });

    $("#search").click(function () {
        $('#tb_departments').bootstrapTable('refresh', {});
    });

    // 操作按钮
    function btnGroup ()
    {
        let html =
            '<a href="#!" class="btn btn-xs btn-info m-r-5 edit-btn" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i>编辑</a>' +
            '<a href="#!" class="btn btn-xs btn-info m-r-5 detail-btn" title="查看" data-toggle="buttons"><i class="mdi mdi-eye">数据列表</i></a>' +
            '<a href="#!" class="btn btn-xs btn-warning del-btn" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i>删除</a>';
        return html;
    }
</script>
</body>
</html>